/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.search.strategy.social;

import java.util.List;

import net.groupme.model.ObjectFactory;
import net.groupme.search.strategy.RankingStrategy;
import net.groupme.search.strategy.model.RankingPreferences;
import net.groupme.search.strategy.model.WeightedResource;
import net.groupme.search.strategy.model.WeightedTag;
import net.groupme.search.strategy.model.WeightedUser;

/**
 * created on May 28, 2008
 * 
 * This class implements only {@link RankingStrategy#rankResources(RankingPreferences)}, which
 * returns the static SocialPageRank list, and {@link RankingStrategy#rankTags(RankingPreferences)},
 * which returns the static SocialSimRank.
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.2 $ $Date: 2008-05-30 01:19:37 $
 */
public class SPR_SSR_RankingStrategyImpl implements RankingStrategy {

	/* (non-Javadoc)
	 * @see net.groupme.search.strategy.RankingStrategy#getDescription()
	 */
	public String getDescription() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.search.strategy.RankingStrategy#getName()
	 */
	public String getName() {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see net.groupme.search.strategy.RankingStrategy#rankResources(net.groupme.search.strategy.model.RankingPreferences)
	 */
	public List<WeightedResource> rankResources(RankingPreferences preferences) {
		if(preferences instanceof PersonalizedSPRRankingPreferences){
			return SocialPageRank.getSocialPageRank(((PersonalizedSPRRankingPreferences)preferences).getSprPreferences(), 10000000, Integer.parseInt(ObjectFactory.getTag(((PersonalizedSPRRankingPreferences)preferences).getTagOfInterest()).getId()));
		}else{
			return SocialPageRank.getSocialPageRank(((SPR_SSR_RankingPreferences)preferences).getSprPreferences(), 10000000, SocialPageRank.NO_TAG_OF_INTEREST);
		}
	}

	/* (non-Javadoc)
	 * @see net.groupme.search.strategy.RankingStrategy#rankTags(net.groupme.search.strategy.model.RankingPreferences)
	 */
	public List<WeightedTag> rankTags(RankingPreferences preferences) {
		return SocialSimRank.getSocialSimRankForTagFromDB(((SPR_SSR_RankingPreferences)preferences).getTagOfInterest(), 10000000, SocialSimRank.SSR_ID_IN_DATABASE);
	}

	/* (non-Javadoc)
	 * @see net.groupme.search.strategy.RankingStrategy#rankUsers(net.groupme.search.strategy.model.RankingPreferences)
	 */
	public List<WeightedUser> rankUsers(RankingPreferences preferences) {
		return null;
	}

}
